﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Yun.Interface;
using Yun.Response;
using Yun.Util;

namespace Yun.IM.Request
{
    /// <summary>
    /// 发送单聊消息方法
    /// yun.im.rongcloud.publish.private.set
    /// </summary>
    public class MessagePublishPrivateRequest : ITopRequest<IntResultResponse>
    {
        /// <summary>
        /// 接收用户ID
        /// </summary>
        public int ToUserId { get; set; }

        /// <summary>
        /// 消息类型
        /// </summary>
        public string ObjectName { get; set; }

        /// <summary>
        /// 发送消息内容
        /// </summary>
        public string Content { get; set; }

        /// <summary>
        /// 显示的Push内容(可选)
        /// </summary>
        public string PushContent { get; set; } = "";

        /// <summary>
        /// pushData:针对 iOS 平台为 Push 通知时附加到 payload 中，Android 客户端收到推送消息时对应字段名为 pushData。（可选）
        /// </summary>
        public string PushData { get; set; } = "";
          

        public string GetApiName()
        {
            return "yun.im.rongcloud.publish.private.set";
        }


        public void Validate()
        {
            RequestValidator.ValidateRequired("touserid", ToUserId);
            RequestValidator.ValidateRequired("content", Content);
        }

        public IDictionary<string, string> GetParameters()
        {
            var parameters = new YunDictionary
            {
                {"touserid", ToUserId},
                {"content", Content},
                {"objectname", ObjectName},
                {"pushcontent", PushContent},
                {"pushdata", PushData}
            };

            return parameters;
        }


    }
}
